#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "glwidget.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    m_playImage = this->findChild<GLWidget *>("widget");
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButtonAddBox_clicked()
{
    QList<QRectF> rects;
    QRectF rect1(10,10, 40,40);
    QRectF rect2(100,100, 100,100);
    rects.push_back(rect1);
    rects.push_back(rect2);

    m_playImage->setRectColor(QVector4D(0.0f, 1.0f, 0.0f, 0.0f));
    m_playImage->setRect(rects);
}

void MainWindow::on_pushButtonClearBox_clicked()
{
    QList<QRectF> rects;
    m_playImage->setRect(rects);
}
